$OpenBSD: patch-agent_mibgroup_udp-mib_data_access_udp_endpoint_openbsd_c,v 1.2 2013/12/27 23:08:02 krw Exp $
--- agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c.orig	Tue Oct  9 18:28:58 2012
+++ agent/mibgroup/udp-mib/data_access/udp_endpoint_openbsd.c	Thu Dec 26 19:54:56 2013
@@ -105,8 +105,8 @@ static int
 _load(netsnmp_container *container, u_int load_flags)
 {
     struct inpcbtable table;
-    struct inpcb   *head, *next, *prev;
-    struct inpcb   inpcb;
+    struct inpcb   *next, *prev;
+    struct inpcb   inpcb, previnpcb;
     netsnmp_udp_endpoint_entry  *entry;
     int      rc = 0;
 
@@ -118,22 +118,29 @@ _load(netsnmp_container *container, u_int load_flags)
 	return -1;
     }
 
-    prev = (struct inpcb *)&CIRCLEQ_FIRST(&table.inpt_queue);
+    next = (struct inpcb *)&TAILQ_FIRST(&table.inpt_queue);
     prev = NULL;
-    head = next = CIRCLEQ_FIRST(&table.inpt_queue);
 
     while (next) {
 	NETSNMP_KLOOKUP(next, (char *)&inpcb, sizeof(inpcb));
-	if (prev && CIRCLEQ_PREV(&inpcb, inp_queue) != prev) {
-	    snmp_log(LOG_ERR,"udbtable link error\n");
-	    break;
+	if (prev != NULL) {
+		if (!NETSNMP_KLOOKUP(prev, (char *)&previnpcb,
+		    sizeof(previnpcb))) {
+	    		DEBUGMSGTL(("udp-mib/data_access/udpConn",
+			    "klookup previnpcb failed\n"));
+			break;
+		}
+		if (TAILQ_NEXT(&previnpcb, inp_queue) != next) {
+		    snmp_log(LOG_ERR,"udptable link error\n");
+		    break;
+		}
 	}
 	prev = next;
-	next = CIRCLEQ_NEXT(&inpcb, inp_queue);
+	next = TAILQ_NEXT(&inpcb, inp_queue);
 
 #if !defined(NETSNMP_ENABLE_IPV6)
         if (inpcb.inp_flags & INP_IPV6)
-            goto skip;
+            continue;
 #endif
         entry = netsnmp_access_udp_endpoint_entry_create();
         if (NULL == entry) {
@@ -163,11 +170,6 @@ _load(netsnmp_container *container, u_int load_flags)
          */
         entry->index = CONTAINER_SIZE(container) + 1;
         CONTAINER_INSERT(container, entry);
-#if !defined(NETSNMP_ENABLE_IPV6)
-    skip:
-#endif
-	if (next == head)
-	    break;
     }
 
     if (rc < 0)
